<!--教员角色查看全部缓考安排-->
<template>
  <div class="paperprint-container" style="width:100%">
    <div class="search-container" style="margin:0;padding:0;height:35px">
      <div class="search-container-left">
        <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
          <el-form-item label="学期批次：" prop="planname">
            <el-select v-model="queryParams.planname" style="width: 135px;margin-right:15px" placeholder="选择批次" clearable size="mini">
              <el-option
                v-for="item in xqList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="考试类型：" prop="checktype">
            <el-select v-model="queryParams.checktype" style="width: 135px;margin-right:15px" placeholder="选择学期" clearable size="mini">
              <el-option
                v-for="item in pyccList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="级次：" prop="studentlevel">
            <el-select v-model="queryParams.studentlevel" style="width: 135px;margin-right:15px" placeholder="选择修习类型" clearable
                       size="mini">
              <el-option
                v-for="(item,index) in njList"
                :key="index"
                :label="item.xqszxn"
                :value="item.xqszxn"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="专业班次：" prop="specialtyclassname">
            <el-select v-model="queryParams.specialtyclassname" style="width: 135px;margin-right:15px" placeholder="选择修习类型" clearable
                       size="mini">
              <el-option
                v-for="item in kcfzrList"
                :key="item.id"
                :label="item.className"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="课程名称：" prop="coursename">
            <el-input
              v-model="queryParams.coursename"
              placeholder="请输入课程名称"
              clearable
              size="mini"
              style="width: 152px;margin-right:15px"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item>
            <div class="search-button" style="margin: 6px 15px 0 0;">
                <img src="../../../assets/assessment/icon-search.png" alt="" style="width:19px;height:19px" />
                <span @click="handleQuery" style="font-size:14px">查询</span>
              </div>
          </el-form-item>
        </el-form>
        <!--        <div class="search-container-item">
                  <span>学期批次：</span>
                  <el-select
                    v-model="xq"
                    style="width: 135px"
                    size="mini"
                    placeholder="请选择"
                  >
                    <el-option
                      v-for="item in xqList"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </div>
                <div class="search-container-item">
                  <span>考试类型:</span>
                  <el-select
                    v-model="pycc"
                    style="width: 80px"
                    size="mini"
                    placeholder="请选择"
                  >
                    <el-option
                      v-for="item in pyccList"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </div>
                <div class="search-container-item">
                  <span>级次:</span>
                  <el-select
                    v-model="xxlx"
                    style="width: 90px"
                    size="mini"
                    placeholder="请选择"
                  >
                    <el-option
                      v-for="item in xxlxList"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </div>
                <div class="search-container-item">
                  <span>专业班次：</span>
                  <el-select
                    v-model="kcfzr"
                    style="width: 102px"
                    size="mini"
                    placeholder="请选择"
                  >
                    <el-option
                      v-for="item in kcfzrList"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </div>
                <div class="search-container-item">
                  <span>考试课程：</span>
                  <el-input
                    style="width: 152px"
                    size="mini"
                    placeholder="请输入内容"
                    v-model="course"
                  ></el-input>
                </div>-->


      </div>
    </div>

    <el-table
      :data="tableData"
      style="width: 100%"
      max-height="650"
      class="xpaas-table-class"
      row-class-name="xpaas-row-class"
      cell-class-name="xpaas-cell-class"
      header-row-class-name="xpaas-header-row-class"
      header-cell-class-name="xpaas-header-cell-class"
    >
      <el-table-column
        type="selection"
        width="55">
      </el-table-column>
      <el-table-column prop="termid" label="日期" width="170" align="center">
      </el-table-column>
      <el-table-column prop="termid" label="节次" width="170" align="center">
      </el-table-column>
      <el-table-column prop="termid" label="系部" width="170" align="center">
      </el-table-column>
      <el-table-column prop="termid" label="教研室" width="170" align="center">
      </el-table-column>
      <el-table-column prop="termid" label="考试课程" width="170" align="center">
      </el-table-column>
      <el-table-column prop="termid" label="授课教员" width="170" align="center">
      </el-table-column>
      <el-table-column prop="termid" label="考试方式" width="170" align="center">
      </el-table-column>
      <el-table-column prop="termid" label="场地需求" width="170" align="center">
      </el-table-column>
      <el-table-column prop="termid" label="批次" width="170" align="center">
      </el-table-column>
      <el-table-column prop="termid" label="队别" width="170" align="center">
      </el-table-column>
      <el-table-column prop="termid" label="级次" width="170" align="center">
      </el-table-column>
      <el-table-column prop="termid" label="专业班次" width="170" align="center">
      </el-table-column>
      <el-table-column prop="termid" label="人数" width="170" align="center">
      </el-table-column>
      <el-table-column prop="termid" label="考场" width="170" align="center">
      </el-table-column>
      <el-table-column prop="termid" label="监考员" width="170" align="center">
      </el-table-column>
    </el-table>
    <!-- <div class="table-header">
        <div class="item" style="width: 67px">
          <el-checkbox
            v-model="rowColumnChecked"
            @change="selectCheck('all')"
          ></el-checkbox>
        </div>
        <div class="item" style="width: 97px">日期</div>
        <div class="item" style="width: 106px">节次</div>
        <div class="item" style="width: 114px">系部</div>
        <div class="item" style="width: 123px">
          教研室
        </div>
        <div class="item" style="width: 116px">
          考试课程
        </div>
        <div class="item" style="width: 119px">
          授课教员
        </div>
        <div class="item" style="width: 136px">
          考试方式
        </div>
        <div class="item" style="width: 111px">
          场地需求
        </div>
        <div class="item" style="width: 124px">
          队别
        </div>
        <div class="item" style="width: 81px">
          级次
        </div>
        <div class="item" style="width: 155px">
          专业班次
        </div>
        <div class="item" style="width: 116px">
          人数
        </div>
        <div class="item" style="width: 145px">
          考场
        </div>
        <div class="item" style="width: 151px">
          监考员
        </div>
      </div>
      <div class="table-body" v-for="(item, index) in tableData" :key="index">
        <div class="item" style="width: 67px">
          <el-checkbox
            v-model="item.rowChecked"
            @change="itemChange('row')"
          ></el-checkbox>
        </div>
        <div class="item" style="width: 97px">{{ item.exadate }}</div>
        <div class="item" style="width: 106px">{{ item.exaschedule }}</div>
        <div class="item" style="width: 114px">{{ item.department }}</div>
        <div class="item" style="width: 123px">{{ item.teachingandresearchsection }}</div>
        <div class="item" style="width: 116px">{{ item.coursename }}</div>
        <div class="item" style="width: 119px">{{ item.teachingfaculty }}</div>
        <div class="item" style="width: 136px">{{ item.checktype }}</div>
        <div class="item" style="width: 111px">{{ item.situdemand }}</div>
        <div class="item" style="width: 124px">{{ item.studentteam }}</div>
        <div class="item" style="width: 81px">{{ item.studentlevel }}</div>
        <div class="item" style="width: 155px">{{ item.specialtyclassname }}</div>
        <div class="item" style="width: 116px">{{ item.biggernumber }}</div>
        <div class="item" style="width: 145px">{{ item.exasite }}</div>
        <div class="item" style="width: 151px">{{ item.exaterid }}</div>
      </div> -->
    
    <div class="bottom-block">
      <div class="export-button">
        <img src="../../../assets/assessment/icon-export.png" alt=""/>
        <!--        <span>导出Excel</span>-->
        <download-excel
          class="export-btn"
          :data="tableData"
          :fields="jsonFields"
          type="xls"
          name="填报课程考试计划.xls"
          style="color: #f3b815"
        >
          &ensp;导出Excel
        </download-excel>
      </div>
      <div class="text">授课教员名字后加“*”为课程负责人</div>
    </div>
  </div>

</template>

<script>
import {examsPlanBuList} from "../../../api/courseExame/coursePlan";
import { reqZybcList,reqCheckYearList } from "@/api/admin1/check";

export default {
  data() {
    return {
      showSearch: true,
      queryParams: {
        planname: undefined,
        checktype: undefined,
        studentlevel: undefined,
        specialtyclassname: undefined,
        coursename: undefined,
      },
      course: "",
      planname: undefined,
      xqList: [],
      checktype: undefined,
      pyccList: [],
      studentlevel: undefined,
      xxlxList: [],
      specialtyclassname: undefined,
      kcfzrList: [],
      tableData: [],
      jsonFields: {
        '日期': 'exadate',
        '节次': 'exaschedule',
        '系部': 'department',
        '教研室': 'teachingandresearchsection',
        '考试课程': 'coursename',
        '授课教员': 'teachingfaculty',
        '考试方式': 'studytype',
        '场地需求': 'situdemand',
        '队别': 'studentteam',
        '级次': 'studentlevel',
        '专业班次': 'specialtyclassname',
        '人数': 'biggernumber',
        '考场': 'exasite',
        '监考员': 'exaterid',
      },
      filepath: "",
      njList: [],
    };
  },
  created() {
    this.queryAllBuHuanExa();
  },
  mounted(){
    this.gradeAll();
    this.getlist();
  },
  methods: {
    //获取年级
    gradeAll(){
      let that = this;
      reqCheckYearList().then(res => {
        if(res.data.code == 200 && res.data.data){
          that.njList = res.data.data;
        }
      });
    },
    //获取专业班次
    async getlist(){
      const result = await reqZybcList();
      result.data.code == 200 ? this.kcfzrList = result.data.data : [];
    },
    queryAllBuHuanExa() {
      examsPlanBuList(this.queryParams).then(res => {
        this.tableData = res.data.data;
        console.log("输出", res.data.data)
      })
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryAllBuHuanExa();
    },
    itemChange(string) {
      this[string + "ColumnChecked"] = this.tableData.every((item) => {
        return item[string + "Checked"];
      });
    },
    selectCheck(choose) {
      if (choose) {
        if (choose === "all") {
          this.tableData = this.tableData.map((item) => {
            return {...item, rowChecked: this.rowColumnChecked};
          });
        } else {
          this.tableData = this.tableData.map((item) => {
            return {
              ...item,
              [choose + "Checked"]: this[choose + "ColumnChecked"],
            };
          });
        }
      }
    },
    changeInputFile() {
      document.getElementById("theFile").click();
      document.getElementById("theFile").onchange = (event) => {
        this.filepath = event.target.value;
      };
    },
  },
};
</script>

<style lang="less" scoped>
.pagination-block {
  margin-top: 20px;
  display: flex;
  flex-direction: row;
  justify-content: center;
}

.paperprint-container {
  .el-checkbox__inner:hover {
    border-color: #004ca7;
  }

  .el-checkbox__inner {
    border: 1px solid #004ca7;
    border-radius: 0;
  }

  .el-checkbox__input.is-checked .el-checkbox__inner,
  .el-checkbox__input.is-indeterminate .el-checkbox__inner {
    background-color: #004ca7;
    border-color: #004ca7;
  }

  .el-checkbox__input.is-checked + .el-checkbox__label {
    color: #004ca7;
  }

  .el-checkbox.is-bordered.is-checked {
    border-color: #004ca7;
  }

  .el-checkbox__input.is-focus .el-checkbox__inner {
    border-color: #004ca7;
  }

  .export-report-container {
    .el-dialog__body {
      padding: 64px 0 64px 50px;

      .el-radio {
        margin-right: 79px;
      }
    }

    .el-dialog__footer {
      padding-bottom: 103px;
    }
  }

  .import-report-container {
    .el-dialog__body {
      padding-left: 165px;
      padding-top: 71px;
      padding-bottom: 60px;

      > div {
        > span {
          font-size: 18px;
          font-weight: bold;
          line-height: 20px;
          color: #004ca7;
          vertical-align: middle;
        }

        > input {
          width: 254px;
          height: 25px;
          border: 1px solid #004ca7;
          opacity: 1;
          border-radius: 4px;
          padding-left: 5px;
          margin-right: 8px;
          color: #004ca7;
          vertical-align: middle;
        }

        > div {
          display: inline-block;
          font-size: 18px;
          padding: 1px 10px;
          border-radius: 4px;
          vertical-align: middle;
          cursor: pointer;

          &:nth-child(3) {
            color: rgba(2, 200, 108, 1);
            background: #f1fff8;
            border: 1px solid #02c86c;
            position: relative;
            margin-right: 20px;

            > input {
              width: 0px;
              position: absolute;
              left: 0;
              opacity: 1;
              cursor: pointer;
            }
          }

          &:nth-child(4) {
            color: rgba(82, 48, 233, 1);
            background: rgba(235, 230, 255, 1);
            border: 1px solid rgba(82, 48, 233, 1);
          }
        }
      }
    }

    .el-dialog__footer {
      padding-bottom: 76px;

      .green {
        padding: 1px 17px;
      }
    }
  }
}
</style>
<style lang="less" scoped>
@import "../../../styles/paper-print.less";
@fontFamily:"Microsoft YaHei";
.xpaas-table-class {
  border: 1px solid #004ca7;
  border-radius: 9px;
  margin: 15px 0;
  > ::v-deep div.el-table__header-wrapper {
    > table.el-table__header {
      > thead {
        > tr.xpaas-header-row-class {
          padding: 0;
          height: 76px;
          background-color: #edf2f9;
          font-size: 16px;
          font-family: Microsoft YaHei;
          font-weight: bold;
          line-height: 20px;
          color: #004ca7;
          > th.xpaas-header-cell-class {
            font-weight: bold;
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
  > ::v-deep div.el-table__body-wrapper {
    > table.el-table__body {
      > tbody {
        > tr.xpaas-row-class {
          > td.xpaas-header-cell-class {
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
          > td.xpaas-cell-class {
            height: 76px;
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            > div.cell {
              font-weight: normal;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
}
/deep/.el-form--inline .el-form-item__label{
    color: #004ca7;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
}
.bottom-block {
  display: flex;
  flex-direction: row;
  justify-content: space-between;

  .export-button {
    width: 127px;
    height: 27px;
    background: #fff6ef;
    border: 1px solid #f3b815;
    border-radius: 4px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin-top: 14px;

    > img {
      width: 17px;
      height: 17px;
    }

    > span {
      margin-left: 12px;
      font-size: 14px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #f3b815;
    }
  }

  .text {
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    line-height: 39px;
    color: #004ca7;
  }
}
</style>
